<script>
	jQuery(function() {
		jQuery( "#rango-hora" ).slider({
			range: true,
			min: 0,
			max: 23.5,
			step: 0.5,
			values: [ 9, 18 ],
			slide: function( event, ui ) {


				if(ui.values[0] - Math.floor(ui.values[0]) == 0){
					if(ui.values[0] < 10){
						var valor_inferior = "0"+ui.values[0]+":00";
					}else{
						var valor_inferior = ui.values[0]+":00";
					}
				}else{
					if(ui.values[0] < 10){
						var valor_inferior = "0"+Math.floor(ui.values[0])+":30";
					}else{
						var valor_inferior = Math.floor(ui.values[0])+":30";
					}
				}

				if(ui.values[1] - Math.floor(ui.values[1]) == 0){
					if(ui.values[1] < 10){
						var valor_superior = "0"+ui.values[1]+":00";
					}else{
						var valor_superior = ui.values[1]+":00";
					}
				}else{
					if(ui.values[1] < 10){
						var valor_superior = "0"+Math.floor(ui.values[1])+":30";
					}else{
						var valor_superior = Math.floor(ui.values[1])+":30";
					}
				}

				jQuery( "#txt-rango-hora" ).val( valor_inferior + " - " + valor_superior );
				jQuery( "#LicenseHoraDesde").val( valor_inferior );
				jQuery( "#LicenseHoraHasta").val( valor_superior );
			}
		});
		jQuery( "#txt-rango-hora" ).val("0" + jQuery( "#rango-hora" ).slider( "values", 0 ) + ":00 - " + jQuery( "#rango-hora" ).slider( "values", 1 ) + ":00" );
	});
</script>
<div class="licenses form">
<?php echo $this->Form->create('License');?>
	<fieldset>
	<?php
		echo $this->Form->input('name',array( 'label' => 'Motivo'));
		echo $this->Form->input('user_id',array( 'label' => 'Profesional'));
		echo $this->Form->input('fecha_desde',array( 'label' => 'Fecha Desde'
                                    , 'dateFormat' => 'DMY'
                                    , 'minYear' => date('Y') - 1
                                    , 'maxYear' => date('Y') + 5));

		echo $this->Form->input('fecha_hasta',array( 'label' => 'Fecha Hasta'
                                    , 'dateFormat' => 'DMY'
                                    , 'minYear' => date('Y') - 1
                                    , 'maxYear' => date('Y') + 5));

		echo $this->Form->input('day_id',array( 'label' => 'Día de la Semana',  'empty' => 'Todos'));
		echo $this->Form->input('hora_desde',array( 'type' => 'hidden', 'value' => '09:00'));
		echo $this->Form->input('hora_hasta',array( 'type' => 'hidden', 'value' => '18:00'));
?>
	<label for="txt-rango-hora">Horario:</label>
	<input type="text" id="txt-rango-hora" style="border:0; color:#f6931f; font-weight:bold;" />
	<div id="rango-hora"></div>
<?php

	?>
	</fieldset>
<?php echo $this->Form->end(__('Cargar', true));?>
</div>